home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 4,401 to 4,500 / aol-file-protocol-4400-4401-to-4500.zip / AOLDLs / PDA-Newton Development / ND IconTool / ICNTL.sit / IconTool.nwt < prev    next >
Text File  |  1995-07-04  |  4KB  |  164 lines

  1. //
  2. //
  3. //  IconTool
  4. //
  5. //    a Newt 3.0+ plug-in (autopart) that contains a function
  6. //    to extract icon information from Ben Gottlieb's Icon Editor
  7. //    to be used by Newt's package frame.
  8. //
  9. //    To use: Install IconTool on your Newton.
  10. //            Create an icon using Icon Editor
  11. //            Include the line:  IconEditor:GetEditorIcon("<the icon>");
  12. //              in the package frame of the source code you are creating
  13. //              where <the icon> is the name of the icon you created in the
  14. //              Icon Editor.
  15. //             
  16. //            Alternatively you can tap on Newt's overview button and select
  17. //              "IconTool" from the list.  Drag the window around so you can
  18. //              see where you want to insert the GetEditorIcon statement. Make
  19. //              sure you can see the insertion point and then tap the Paste
  20. //              button.  Edit the statement to include the name of your icon.
  21. //
  22. //            NOTE: You can drag the information window of IconTool by the
  23. //                  bottom edge.
  24. //
  25. //------------------------
  26. //   IconTool is freeware.
  27. //      Serg Koren
  28. //      archimag@netaxs.com
  29. //      SergK@eworld.com
  30. //
  31. //   Ver 1.0 07/04/95
  32. //
  33. //------------------------ 
  34. //  Check out my Newton reviews on http://www.netaxs.com/~archimag/revw.html
  35. //------------------------
  36.  
  37.  
  38. // This is the main method that you call.
  39. //  SYNTAX: IconTool:GetEditorIcon("<the icon>")
  40. //
  41. IconTool.GetEditorIcon
  42. func(which)
  43. begin
  44.     
  45.     local iconsoup := GetUnionSoup("Icons:BenG");
  46.     local entry :=  (cursor := Query(iconsoup, {type: 'index})):entry();
  47.  
  48.     // check for the icon name we want
  49.     while entry do
  50.     begin
  51.  
  52.         if StrEqual(entry.name, which) then 
  53.             return entry.icon;    // return it...
  54.  
  55.         entry := cursor:Next();
  56.             
  57.     end;
  58.  
  59.     return nil;    // return icon name not found...
  60. end
  61. -----
  62. init
  63. func()
  64. begin
  65. // define some constants
  66.  
  67. :defConst('kNewtSymbol,   '|NewtDevEnv:TKnollSys|);
  68. :defConst('kPlugType,'tools);
  69. :defConst('kPlugSymbol,'IconTool);
  70. end
  71. -----
  72. IconTool._package.InstallScript
  73. func(partFrame,removeFrame)
  74. begin
  75.     local gData := GetGlobals().(kNewtSymbol);
  76.     if not gData then
  77.         GetGlobals().(EnsureInternal(kNewtSymbol)) := gData := EnsureInternal({constants:{}, libraries: {}, protos: {}, tools: {}, views: {}, });
  78.     gData.(kPlugType).(EnsureInternal(kPlugSymbol)) := partFrame.partData.(kPlugSymbol);
  79. end
  80. -----
  81. IconTool._package.RemoveScript
  82. func(removeFrame)
  83. begin
  84.     RemoveSlot(GetGlobals().(kNewtSymbol).(kPlugType), kPlugSymbol);
  85. end
  86. -----
  87. IconTool
  88. // :doObj('add,'IconTool)
  89. // :doObj('build,'IconTool)
  90. // :doObj('Remove,'IconTool) 
  91. //:saveApp(IconTool)
  92. {
  93. // 
  94.  
  95.     _proto: protoFloatNGo,
  96.     title: "Icon Tool",
  97.     viewFlags: vFloating + vClickable,
  98.     viewBounds: RelBounds(0,6,200,170),
  99.  
  100.     _package: {
  101.         version: 100,    // we scale this to n.nn
  102.         copyright: "⌐ 1995 by Serg Koren - Freeware",
  103.         // devSignature should default to "Newt"
  104.     },
  105.  
  106.     viewClickScript: func(unit)
  107.     begin
  108.         IconTool = self and :Drag(unit,nil);    // drag it around....
  109.     end,
  110.  
  111.     viewSetupFormScript: func()
  112.     begin
  113.         self.IconTool := self;                    // for dragging
  114.         inherited:?viewSetupFormScript();
  115.     end,
  116.     
  117. }
  118. -----
  119. IconTool._package.partData
  120. {
  121.     IconTool: IconTool._proto        // this is required by the autopart
  122.  
  123.  
  124. }
  125. -----
  126. IconTool+maboutText
  127. {
  128. // about text
  129.  
  130.     viewclass: 'clParagraphView,
  131.     
  132.     text: " \u000D\u " && IconTool._package.copyright && "\u000D\u Version" && SubStr( NumberStr(IconTool._package.version),0,1) & "." & SubStr( NumberStr(IconTool._package.version),1,2) & "\u000D\u email:  SergK@eworld.com" &  "\u000D\u \u000D\u  Newt Tool for extracting icons from \u000D\u Ben Gottlieb's Icon Editor.\u000D\u \u000D\u SYNTAX:  \u000D\u  IconTool:GetEditorIcon(<the icon>);",
  133.     viewFlags: 3,
  134.     viewBounds: RelBounds(35,20,300,180),
  135.  
  136. }
  137. -----
  138. IconTool+paste
  139. {
  140. // button that lets us paste the method call into the insertion point
  141.  
  142.     _proto: protoTextButton,
  143.     viewBounds: RelBounds (165, 5,35 ,15),
  144.     text: "Paste",
  145.  
  146.     buttonClickScript: func()
  147.     begin
  148.         PostKeyString('viewFrontKey, "IconTool:GetEditorIcon( );");
  149.         PlaySound(ROM_click);
  150.         IconTool:close();    // get rid of our window
  151.     end,
  152.  
  153. }
  154. -----
  155. IconTool+mytitle
  156. {_proto: protoStaticText,
  157. viewBounds: RelBounds (20 ,20 ,100 ,37 ),
  158. text: "Icon Tool",
  159.  
  160. }
  161.  
  162. -----
  163. BYE!
  164.